<?php
namespace Components\Traits;

trait DiTraits {
  protected static $_di = null;

  public static function setDI() {
    if(is_null(self::$_di)) {
      self::$_di = new self();
    }
    return self::$_di;
  }

  public static function getDI() {
    return self::setDI();
  }
  
  public function getFactory($name = null, $parameters = null) {
    return $this -> setFactory($name, $parameters, false);
  }
  
  public function getSharedFactory($name = null, $parameters = null) {
    return $this -> setFactory($name, $parameters);
  }
}
